Open
Conversation
to prevent memory leaks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for custom SVG markers. SVG is read from a user-chosen property (just like custom icon names), parsed, and rendered onto the map. This allows users to use custom marker shapes beyond the Lucide icon composite markers. It also enables data-driven markers, for example, for displaying values such as ratings/prices or varying the size of a marker via formulas.
The SVG property or formula is expected to evaluate to a valid SVG element wrapped in
<svg></svg>. SVGs with explicit dimensions (width/heightproperty on the<svg>element) render at a fixed size, SVGs with onlyviewBoxscale with zoom just as normal markers. Invalid SVGs show a fallback marker with error details in the popup.Marker property precedence is: Custom SVG marker --> Custom Icon marker --> Default marker. This makes it possible to use SVG markers only for specific entries, falling back to icon or default markers for others.
Main changes
markers.ts: Add SVG parsing (using DOMParser), validation, and renderingpopup.ts: Display SVG validation errorsexapmles/: Added demo views showing static, dynamic text, and dynamic size SVG markers via formulas and a per-entry SVG marker via a plain frontmatter property.Limitations
scripttags, event handlers, animations etc.)svgelement must have eitherviewBoxor explicitwidth/heightattributes)Examples
Simple markers using a formula

Dynamic text markers displaying the

ratingpropertyDynamic size markers

Per-Item marker using a simple frontmatter property

(Public domain Eiffel tower SVG from Wikimedia Commons)
If you consider merging this, I'll be happy to make any changes needed or add documentation for the feature in the Map View docs.